<h1>Blog</h1>

<div id="posts" class="span-18">
  <% @blog_posts.each do |blog_post| %>
    <div class="post">
      <h2><%= link_to blog_post.title, blog_post_url(blog_post) %></h2>
      <p class="date_posted"><%= blog_post.published_at.strftime("%Y") %> <span class="month_day"><%= blog_post.created_at.strftime("%B %d") %></span></p>
      <div class="body">
        <%= blog_post.body_html %>
      </div>
      <% if blog_post.tags.size > 0 %>
        <p class="tags"><span class="alt">Posted in:</span> <%= blog_post.tags.collect{|t| "<a href='/blog?tag=" + t.name.downcase + "'>" + t.name + "</a> "} %></p>
      <% end %>
    </div>
  <% end %>
  <% if @blog_posts.size > 1 %>
    <%= will_paginate(@blog_posts) %>
  <% end %>
</div>

<div id="side_bar" class="span-6 last">
  <div class="span-6" id="about-the-author">
    <h3>About The Author</h3>
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. </p>
    <p><%= link_to "More", about_url %></p>
  </div>  

  <div class="span-6" id="monthly-archive">
    <h3>Monthly Archive</h3>
    <ul>
      <% BlogPost.post_months.each do |m| %>
      <li><%= link_to m.label, "/blog/#{m.year_number.to_s}/#{m.month_number.to_s}" %></li>
      <% end %>
    </ul>
  </div>

  <div class="span-6" id="tags">
    <h3>Topics</h3>
    <ul>
      <% @tags.each do |t| %>
        <li><%= link_to t.name, category_url(t) %> <span class="quiet">(<%= t.count %>)</span></li>
      <% end %>
    </ul>
  </div>

</div>


